Skip to content

Implement SIAF fondations staging endpoint - #337

Merged
skelz0r merged 7 commits into
developfrom
feature/api-7216-mep-environnement-de-test-api-donnees-fondations-api-siaf
Aug 20, 2026
Merged

Implement SIAF fondations staging endpoint#337
skelz0r merged 7 commits into
developfrom
feature/api-7216-mep-environnement-de-test-api-donnees-fondations-api-siaf

Conversation

@skelz0r

@skelz0r skelz0r commented Aug 17, 2026

Copy link
Copy Markdown
Member

Les 2 premiers commits sont des micro enhancements.

Le reste solve https://linear.app/pole-api/issue/API-7216

Il y a eu quelques changements sur la payload de l'issue pour sortir une version ~ish sûre (les champs décrit dans le ticket et référencé dans la doc comme "Prochainement" ont été supprimé).

Globalement ce qu'il faut relire c'est la tête de la payload, les définitions, le reste c'est full bouchonné donc peu intéressant. Il y a des tartines d'explications métiers/techniques dans le commit principal.

@skelz0r skelz0r self-assigned this Aug 17, 2026
@linear

linear Bot commented Aug 17, 2026

Copy link
Copy Markdown

API-7216

@skelz0r
skelz0r force-pushed the feature/api-7216-mep-environnement-de-test-api-donnees-fondations-api-siaf branch 4 times, most recently from 221edd5 to ff2a8c3 Compare August 19, 2026 08:09
@skelz0r

skelz0r commented Aug 19, 2026

Copy link
Copy Markdown
Member Author
screenshot-2026-08-19--10-11-07--000951 entreprise api localtest me_3000_catalogue_siaf_fondations

@skelz0r
skelz0r marked this pull request as ready for review August 19, 2026 08:14
@skelz0r
skelz0r requested review from Samuelfaure and Un3x August 19, 2026 08:14
@skelz0r

skelz0r commented Aug 19, 2026

Copy link
Copy Markdown
Member Author

@Charlottecho @DorineLam comment au dessus pour la vue --^

@Samuelfaure Samuelfaure left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je request change seulement pour le nom du scope

Comment thread commons/data/authorizations.yml Outdated
Comment thread siade/spec/support/helpers/rnf_id.rb Outdated
Comment thread siade/app/validators/rna_id_format_validator.rb Outdated
The OpenAPI x-codeSamples always targeted production, but an endpoint in
prochainement mode raises EndpointNotYetImplemented there: an integrator
copying the sample would hit an error instead of the staging mock.
Endpoints tagged "Prochainement" now get their curl example generated
against staging.entreprise.api.gouv.fr, the only host that can actually
serve them — and the sample switches back to production by itself when
the tag is removed at production release.
New API Entreprise endpoint GET /v3/ministere_interieur/siaf/fondations/
{siren_or_siret_or_rnf}, exposing foundations (FRUP, FE, FDD) data from
the Répertoire National des Fondations operated by the Ministère de
l'Intérieur through the SIAF hub.

The endpoint is scaffolded in "prochainement" mode: MakeRequest inherits
from MockedInteractor, so it only answers on staging (mocked payloads)
and raises EndpointNotYetImplemented in production. This lets consumers
discover the contract and integrate against staging while the real SIAF
integration (auth, quota, production data) is still being contractualized
with the provider — the deadline is a staging release, not a production
one.

The response objects mirror the categories of the MI data reference,
which lists, per field, the upstream technical name and whether it
is served today: identifiants + identite (category 1), activite (2),
dirigeants (3), liens_entre_organismes (4), situation_financiere (6),
dossiers (8), documents (9). Keeping the reference's own grouping means a
field added upstream lands in an obvious place instead of forcing a
reshuffle.

The call key accepts SIREN, SIRET or the RNF identifier. The RNF code is
the official foundation identifier, set by décret n° 2024-720 of 5 July
2024, and formatted {department}-{type}-{number}-{suffix} — e.g.
075-FDD-00422-08 — which is what RNFIdFormatValidator enforces (the
example "FE-09303920-393" found in the reference spreadsheet is not the
registry format). It is also the only reliable key: ~22% of foundations
have no SIRET, and the provider states the SIRET is not trustworthy in
the SIAF referential. SIREN/SIRET are still accepted because API
Entreprise consumers key on them; the hub exposes no by_siren/by_siret
route, so the resolution will go through its advanced_search route at
wiring time.

What the contract deliberately leaves out, and why:

- Category 8 beyond the two fields the foundation record carries
  (isAccountLate, accountDepositYears): JOAFE publication dates and
  parution/avis numbers, the list of filed dossiers and their type,
  statutory amendment and dissolution effective dates, deposit and
  decision dates. All of it lives behind a separate SIAF "dossiers"
  route. One API Entreprise call must stay one provider call — merging
  two upstream calls doubles the latency and the failure surface for
  data that is secondary to the identity use case.
- Address, identifier and name of the legal entities a director
  represents (legalEntity.address / publicId / name): the field comes
  back empty ({}) on the DEV sample, and the only documented occurrence
  has publicId, name and country at null. We do not publish a field we
  cannot show working; adding it once the referential feeds it is
  backward compatible.
- Every "Future démarche" field of the reference (accounting amounts,
  countries and amounts of foreign financing, details of public
  generosity campaigns, liquidator, consumable endowment): publishing
  them now would force a breaking change when the upstream schema
  materializes; adding them later is backward compatible. The fiche
  announces them as a roadmap so integrators know the contract grows.
- Technical hub noise (hub_timestamp, createdAt, updatedAt, prefixS3,
  checksum) and website, never filled on the sample.
- The justificatives themselves: only their metadata is exposed. The
  download is a binary served by a distinct SIAF route and deserves its
  own endpoint rather than being smuggled into this one.
- isPersonDataPrivate, the provider-side flag gating the diffusion of
  director data per requesting administration: it has no meaning until
  the real integration exists, and will have to be honoured then.

Three vocabulary decisions in the schema:

- documents[].type is a closed enum of the twelve types the reference
  lists (category 9 "Pièce jointe"), ordered from the most frequent
  (statuts, comptes, rapport d'activité, procès verbal, which account for
  nearly every file observed on the DEV sample) down to the
  administrative and judicial acts a foundation only ever gets in
  trouble. It is non-nullable: typeFile is a required string upstream
  (FileMetadataFondationResponse), and advertising null would invite
  consumers to write dead branches. The reference flags one label as
  being renamed ("acte d'autorisation ou acte de non opposition" →
  "décision de l'administration"); the current label is kept, renaming it
  before the provider ships the change would document a value SIAF does
  not send.
- etat is described in prose rather than enumerated. The reference
  (category 1, "Etat de la structure") spells the states in French
  sentence case — en activité, suspendu, transformé, fusionné, scindé,
  dissous, the transformé/fusionné/scindé trio being exactly what
  liens_entre_organismes then details — while the SIAF DEV environment
  answers "Active". Freezing an enum on either spelling would put a wrong
  closed list in the public contract and would make our own staging
  fixtures lie. The vocabulary is to be pinned with the provider when the
  real integration lands.
- date_cloture_exercice states its order explicitly ("mois/jour, format
  MM-DD"): the upstream value is month-first ("12-31"), and a title
  reading "jour/mois" would have an integrator parse it as the 12th of a
  31st month and either crash or silently swap the fields.

The RNF identifier is matched case-insensitively: the FRUP/FDD/FE
segment and the optional department letter (2A/2B) are fixed markers of
the identifier's grammar, not data, so 075-fdd-00422-08 designates the
same foundation as 075-FDD-00422-08 and must not be rejected as
malformed.

Documents referenced here lives within https://linear.app/pole-api/issue/API-7216
Three representative foundations, one per legal type, so integrators can
exercise the contract's edge cases on staging:
- FRUP with a SIRET, reachable by RNF id, SIREN and SIRET (real public
  identity, Maison de la Chimie, with fictional contact and directors);
- FDD without SIRET, reachable only by RNF id — the case of ~22% of the
  referential;
- FE with a due date, a director representing a legal entity, and
  overdue accounts.

The staging token must carry every scope declared in authorizations.yml
(enforced by mocks' acceptance spec), so it is regenerated to include
the new fondations scope.
The fiche carries an alert stating the API is only callable on staging:
the "Prochainement" swagger tag alone flags the endpoint as upcoming but
does not tell integrators they can already try it on the test
environment, which is the whole point of this release.

The data description announces the roadmap (financial statements
amounts, foreign financing details, liquidator…) so early adopters know
the contract will grow: these fields are declarative data the SIAF
referential does not collect yet.

The fiche is attributed to the existing 'mi' provider, like the RNA
ones: SIAF is a Ministère de l'Intérieur system, not a separate
organisation. A dedicated provider entry would need its own logo asset
(providers/api_entreprise/<uid>.png) — every page rendering the partners
section fails without it — and would only make sense the day SIAF staff
get their own provider space.

The release is also announced in config/changelogs.yml (required for
any catalogue change): the entry links the fiche through endpoint_path
and stresses that the API is only callable on staging for now, so
readers don't try it in production.

The fiche declares the 'fondations' entity rather than reusing
'associations': the two registries are distinct (RNF vs RNA) and the
catalogue filters on that facet, so classifying foundations as
associations would surface this endpoint under the wrong search. The
entity is new, hence its label and icon are added to the site locales —
an entity without a translation renders blank on the catalogue.
Output of siade/bin/generate_swagger.sh. The generated spec is what the
site and the SDK scaffolding read, so leaving it stale would keep
serving a contract that does not exist to every consumer.

The fondations curl sample targets the staging host, as for any
prochainement endpoint.
Ruby and Node api_entreprise clients gain
ministere_interieur.fondations(siren_or_siret_or_rnf), scaffolded from
the regenerated OpenAPI spec. Minor bump per SemVer: new endpoint, no
breaking change. The endpoint only answers on staging for now
(prochainement mode), which the changelogs state so SDK users don't
report production 501s as bugs.
The scope index is flat and shared by every API Entreprise endpoint, so a
bare `fondations` would collide with any future foundations-related dataset
coming from another provider. Suffixing with the provider and its
information system (MI / SIAF) keeps the scope unambiguous, consistent with
the endpoint's controller path, and readable in the token scope list shown
to integrators.

The staging token embeds every scope declared in authorizations.yml (checked
by mocks' acceptance spec), hence its regeneration.
@skelz0r
skelz0r force-pushed the feature/api-7216-mep-environnement-de-test-api-donnees-fondations-api-siaf branch from ff2a8c3 to 288df3f Compare August 19, 2026 08:59
@skelz0r
skelz0r requested a review from Samuelfaure August 19, 2026 09:00
@Charlottecho

Copy link
Copy Markdown
Contributor

@skelz0r :

A- Deux API = deux scopes différents
l'issue linear : as tu suivi ce schéma ? Je ne vois pas cette information précisée dans la documentation ni dans la signature de l' API
Par exemple : date décision répressive uniquement autorisé pour le cas d'usage lutte contre la fraude

B - API en mode "prochainement" : API en mode "bac à sable" . Prochainement peut induire qu'elle est disponbile prochainement mais n'induit pas qu'elle est disponible en "test" maintenant .

C- "Le périmètre de données sera progressivement enrichi au fur et à mesure de
l’alimentation du référentiel par les démarches des fondations : données
comptables chiffrées (bilan, produits, charges, résultat), montants et pays
des financements étrangers, détail des campagnes d’appel à la générosité
publique, liquidateur, caractère consomptible de la dotation." :
_
Voici la liste complète des données enrichies par le MI prochainement :

Donnée / bloc | Évolution attendue côté MI | À indiquer dans la documentation API Entreprise -- | -- | -- /dossiers | Alimentation en cours. Doit remplacer /events | « Enrichissement ultérieur / alimentation en cours » type_file des documents | Typologie documentaire à alimenter | Prévu T4 2026 Métadonnées documentaires | Compléter notamment byteSize, checksum, originalName lors du passage des déclarations par DN | « Alimentation progressive » Adresses | Complément/enrichissement via DS_adresse et la BAN | « Enrichissement ultérieur » Liquidateur | Informations sur le liquidateur à alimenter/compléter | « Enrichissement ultérieur » Dotation | Notamment caractère consomptible ou non de la dotation | « Enrichissement ultérieur » Données comptables / financières | Enrichissement des données financières chiffrées : bilan, compte de résultat, budget réalisé, budget prévisionnel, etc. | « Enrichissement ultérieur » Financements étrangers | Compléter le déclaratif avec les montants et pays | « Enrichissement ultérieur » Appel à la générosité publique | Ajouter le détail des campagnes/déclarations et données financières associées | « Enrichissement ultérieur » – périmètre fraude Activité internationale réalisée | Compléter avec les exercices concernés, pays et montants envoyés à l'étranger | « Enrichissement ultérieur » – périmètre fraude Données de contrôle / fraude | Enrichissement des informations et pièces nécessaires au contrôle | « Enrichissement ultérieur » – habilitation fraude Date de dernière modification | À compléter/fiabiliser pour permettre de connaître la fraîcheur de la donnée et faciliter la synchronisation | À documenter lorsque disponible

Soit on publie une liste exhaustive , soit on ne liste pas les documents : je serai pour publier la liste complète ( qui sera confirmée par le MI ) .

@skelz0r

skelz0r commented Aug 20, 2026

Copy link
Copy Markdown
Member Author

A -> Non, j'ai simplifié car le sujet des cas d'usages a été écarté
B -> C'est le wording générique pour tous les APIs en test
C -> ta liste est technique, la mienne est métier et regroupe la même chose, plus d'infos sur le détail exacte de ce qui a été retiré dans le message de commit 5ecde8f

@skelz0r

skelz0r commented Aug 20, 2026

Copy link
Copy Markdown
Member Author

Pour étoffer C, il n'y a aucune réalité d'une potentielle existence de ces futures informations. J'ai épuré au max avec ce qui est potentiellement safe (et encore je ne peux pas le vérifier).

Ce qu'il faut retenir ici c'est qu'il y a que peu de chance que cette signature soit viable vu l'état d'avancement de l'API actuelle.

@skelz0r
skelz0r merged commit 1dd6099 into develop Aug 20, 2026
31 of 32 checks passed
@skelz0r
skelz0r deleted the feature/api-7216-mep-environnement-de-test-api-donnees-fondations-api-siaf branch August 20, 2026 14:43
@Charlottecho

Copy link
Copy Markdown
Contributor

Suite échange avec @skelz0r :

  • Signature de l' API validée ✅ => On sort 1 seul endpoint
  • Tag "test" : à revoir le verbatim des tags "peu clairs" en équipe
  • Liste des données non renvoyées ont été listées par Loic en langage métier et résumé .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants